//递归路由
export const recursionRouter = (powerID, allRouter) => {
    let realRoutes = [];
    allRouter.forEach(item1 => {
        powerID.forEach(item2 => {
            if (item1.meta.name == item2.name) {
                realRoutes.push(item1)
                if (item1.children?.length && item2.children?.length) {
                    item1.children = recursionRouter(item2.children, item1.children)
                }
            }
        })
    })
    return realRoutes;
}

// 设置路由
export const setDefaultRoute = (routes) => {
    routes.forEach(item => {
        if (item.children?.length) {
            item.redirect = item.children[0].path;
            setDefaultRoute(item.children)
        }
    })
}